﻿namespace Origin2.Core
{
    /// <summary>
    /// Represents something that can contain other objects
    /// </summary>
    public interface IObjectContainer
    {
        /// <summary>
        /// Adds an IObject to this IObjectContainer
        /// </summary>
        /// <param name="name"> The name of the object </param>
        /// <param name="obj"> The object to add </param>
        void AddObject(string name, IObject obj);

        /// <summary>
        /// Gets an IObject from this IObjectContainer
        /// </summary>
        /// <param name="name"> The name of the object to get </param>
        /// <returns> The found object </returns>
        IObject GetObject(string name);

        /// <summary>
        /// Removes an IObject from this IObjectContainer
        /// </summary>
        /// <param name="name"> The name of the IObject to remove </param>
        void RemoveObject(string name);

        /// <summary>
        /// Gets whether an IObject with the given name is contained in this IObjectContainer
        /// </summary>
        /// <param name="name"> The name to search for </param>
        /// <returns> Whether this IObjectContainer contains an IObject with the given name </returns>
        bool ContainsObject(string name);

        /// <summary>
        /// Gets whether the given IObject is contained in this IObjectContainer
        /// </summary>
        /// <param name="obj"> The IObject to search for </param>
        /// <returns> Whether the given IObject is contained in this IObjectContainer </returns>
        bool ContainsObject(IObject obj);

        /// <summary>
        /// Makes a name that has not been used in this IObjectContainer, given a base name
        /// </summary>
        /// <param name="baseName"> The base part of the name (this has parts added on to it to make it unique) </param>
        /// <returns> The generated name </returns>
        string GetUniqueName(string baseName);
    }
}
